
<?php	
	class template extends database
	{
		var $connection = '';	

		function template()
		{
			parent::database();
		}
		function GetListPaging()
		{						
			$this->setQuery("set names utf8");
			$this->query();
			return $sql = "Select * from vnf_template";			
			//return $pager;
			//$rs = $pager->paginate();
	//Loop through the result set
				
			/*$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;*/
		}
		
		function GetList()
		{						
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Select * from vnf_template";			
						
			$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;
		}
		
		function AddTemplate($name, $path, $description, $image)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Insert into vnf_template(template_name,template_path, template_description, template_image) values('".$name."', '".$path."', '".$description."', '".$image."')";
			$this->setQuery($sql);
			$this->query();
		}
		
		function UpdateTemplate( $id, $name, $path, $description, $image)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Update vnf_template set template_name='".$name."', template_path='".$path."', template_description='".$description."', template_image='".$image."' ";
			$sql .= " where template_id=".$id;			
			
			$this->setQuery($sql);
			$this->query();
		}
		
		function GetOneTemplate($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Select * from vnf_template where template_id=".$id." ";
			$this->setQuery($sql);
			$row = $this->loadOneRow();
			return $row;
		}
		
		function DeleteTemplate($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Delete from vnf_template";
			$sql .= " where template_id=".$id;			
			
			$this->setQuery($sql);
			$this->query();
		}
		
	}
?>